PImage leftOv;
PImage rightOv;
PImage topOv;
PImage bottomOv;
color rectColor;
boolean leftOver = false;
boolean rightOver = false;
boolean topOver = false;
boolean bottomOver = false;
//
//
void drawEdges(float mypX, float mypY)
{  
rectColor = color(#2E3233);
updateEdges(mypX, mypY);
noStroke();
//GO
if (leftOver) { 
beginShape();
texture(leftOv);       
vertex( 0, 0,0,0);
vertex( 100,0,50,0);
vertex( 100,stgH,100, 100);
vertex( 0,stgH,0,100);
endShape();
}
//GO
if (rightOver) {
for (int j=0; j<nr; j++) R[j].picked=false;  
beginShape();
texture(rightOv);       
vertex( stgW-100,0,0,0);
vertex( stgW,0,50,0);
vertex( stgW,stgH,100,100);
vertex( stgW-100,stgH,0,100);
endShape();
}
//GO
if (topOver) {
beginShape();
texture(topOv);       
vertex( 0,0,0,0);
vertex( stgW,0,50,0);
vertex( stgW,100,100,100);
vertex( 0,100,0,100);
endShape();
}
//GO
if (bottomOver) {
//for (int j=0; j<nr; j++) R[j].picked=false; 
beginShape();
texture(bottomOv);       
vertex( 0,stgH-200,0,0);
vertex( stgW,stgH-200,50,0);
vertex( stgW,stgH,100,100);
vertex( 0,stgH,0,100);
endShape();
}
}

//
void updateEdges(float x, float y)
{
  if      (theHover(0, 0, 100, stgH, x, y)) {       leftOver = true;} 
  else if (theHover(stgW-100, 0, 100, stgH, x, y) ) {    rightOver = true;} 
  else if (theHover(0, 0, stgW, 100, x, y) ) {      topOver = true;}   
  else if (theHover(0, stgH-100, stgW,100 , x, y) ) {    bottomOver = true;} 
  else {
    leftOver = false; 
    rightOver = false; 
    topOver = false;
    bottomOver = false;
  }
}
boolean theHover(int x, int y, int width, int height, float mypX, float mypY) 
{
  if (
  mypX >= x && mypX <= x+width && 
      mypY >= y && mypY <= y+height) {
    return true;
  } else {
    return false;
  }
}

